package model

import "time"

type Question struct {
	HTML       string
	ID         uint64    `json:"question_id" db:"id"`
	QuestionID uint64    `json:"question_sn,string" db:"question_id"`
	AuthorID   uint64    `json:"question_author_id,string" db:"author_id"`
	CategoryID int32     `json:"question_category_id" db:"category_id"`
	Status     int8      `json:"question_status" db:"status"`
	Caption    string    `json:"question_caption" db:"caption"`
	Content    string    `json:"question_content" db:"content"`
	CreateTime time.Time `json:"question_create_time" db:"create_time"`
	UpdatedAt  time.Time `json:"question_updated_at" db:"update_time"`
}

// 问题扩展表
type QuestionEx struct {
	QuestionSn uint64    `json:"question_ex_sn" db:"question_sn"`
	ViewNum    int       `json:"view_num" db:"view_num"`
	CmtNum     int       `json:"cmt_num" db:"cmt_num"`
	ZanNum     int       `json:"zan_num" db:"zan_num"`
	UpdatedAt  time.Time `json:"updated_at" db:"updated_at"`
}

type QuestionInfo struct {
	Question
	QuestionEx
}

// 单个问题
type ApiQuestion struct {
	QuestionInfo
	AuthorName     string    `json:"author_name"`
	AnswerCount    int       `json:"answer_count"`
	AnswerAuthor   string    `json:"answer_author_name"`
	AnswerTime     time.Time `json:"answer_create_time"`
	AnswerUpdateAt time.Time `json:"answer_update_time"`
}

// 问题列表
type QuestionList struct {
	QuestionList []*Question `json:"question_list"`
	TotalCount   int         `json:"total_count"`
}

type ApiQuestionList struct {
	QuestionList []*ApiQuestion `json:"question_list"`
	TotalCount   int            `json:"total_count"`
}

type ApiQuestionDetail struct {
	Question
	AuthorName   string `json:"author_name"`
	CategoryName string `json:"category_name"`
}
